<template id="shop">
    <div class="shop_box">
        <div class="shop_cj" v-if="red_shop">
            <div class="shop">
                <img src="../image/blue_da.png" alt="" @click="getShop()">
                <h4>购物车</h4>
                <span @click="complete()">{{edit}}</span>
                <img src="../image/blue_x.png" alt="">
            </div>
        </div>
        <!--站位容器-->
        <div style="width:100%;height:0.8rem;" v-if="red_shop"></div>

        <div class="shop_te" v-show="red_shop">

            <div class="shop_add">
                <div class="shop_con" v-show="! address_line.consignee" @click="addressShow()">
                    <img src="../image/blue_address.png" alt="">
                    <h5>添加地址</h5>
                    <img src="../image/day.jpg" alt="">
                </div>

                <div class="shop_detail_add_2" v-show="address_line.consignee" @click="addressShow()">
                    <div class="shop_con_detail">
                      <!--  <img src="../image/blue_x.png" alt="">-->
                        <img src="../image/day.jpg" alt="">
                        <img src="../image/blue_address.png" alt="">
                        <p><span>{{address_line.consignee}}</span><span>{{address_line.mobile}}</span></p>
                        <p>{{address_line.address}}</p>
                    </div>
                </div>
            </div>
            <ul class="shop_list">
                <li>商品清单</li>
                <li>总重约{{all_weight}}kg</li>
            </ul>
            <div class="shop_min">
                <div class="shop_lis" v-for="v in cart_list">

                    <div class="shop_d_1">
                        <span v-if="v.is_gift != 1" v-bind:class="GLOBAL.isInArray(v.rec_id, rec_ids) ? 'radio radio_selected' : 'radio'" @click="choice(v.rec_id)"></span>
                        <span v-if="v.is_gift == 1" v-bind:class="GLOBAL.isInArray(v.rec_id, rec_ids) ? 'radio radio_selected' : 'radio'"></span>
                        <img :src="v.goods_thumb" alt="">
                    </div>

                    <div class="shop_d_2">
                        <h6>{{v.goods_name}}</h6>
                        <p class="sp_p" v-if="v.goods_attr_id < 1">{{v.goods_share}}  {{v.goods_weight}}kg</p>
                        <p class="sp_p" v-if="v.goods_attr_id > 0">{{v.attr_str}}</p>
                        <div class="shop_add_r">
                            <span>¥{{v.goods_price}}</span>
                            <!--<span>当日到</span>-->
                        </div>
                    </div>

                    <div class="shop_d_3">
                        <img src="../image/delm.png" alt="" class="del_m" v-if="pro_1" @click="delCart(v.rec_id)">
                        <div class="shop_a_j" v-bind:id="'save_num_' + v.rec_id" data="1">
                            <div v-if="v.is_gift != 1" class="j_1" @click="saveNumber(v, 1)"><img src="../image/blue_jian.png" alt=""></div>
                            <span class="yi">{{v.goods_number}}</span>
                            <div v-if="v.is_gift != 1" class="jia_add" @click="saveNumber(v, 2)"><img  src="../image/blue_add.png" alt=""></div>
                        </div>
                    </div>

                </div>
                <!--新版购物车的优化改版-->
                       <div class="shop_border"></div>
                        <div class="shop_zong">
                            <span>商品总价</span>
                            <span>¥{{all_amount}}</span>
                        </div>
                        <div class="shop_goods_m">
                              <p class="shop_goods_m_p" v-for="v in gift_infos">
                                  <span>赠</span>
                                  <span>{{v.desc}}</span>
                                  <span>－¥{{v.amount}}</span>
                              </p>
                            <p class="shop_goods_m_p" v-for="v in try_infos">
                                <span>试</span>
                                <span>{{v.desc}}</span>
                                <span>－¥{{v.amount}}</span>
                            </p>
                              <p class="shop_goods_m_p" v-for="v in discount_infos">
                                  <span>促</span>
                                  <span>{{v.desc}}</span>
                                  <span>－¥{{v.amount}}</span>
                              </p>

                              <p class="shop_goods_m_p" v-if="whole_discount.desc">
                                  <span>满</span>
                                  <span>{{whole_discount.desc}}</span>
                                  <span>－¥{{whole_discount.amount}}</span>
                              </p>
                              <p class="shop_goods_m_p_te" @click="get_show_red()">
                                  <span>包</span>
                                  <span>红包</span>
                                  <span v-if="bonus_number > 0" v-bind:style='show_y' >
                                      {{bonus_amount > 0 ? '-￥' + bonus_amount : bonus_number + '个红包可用'}}
                                  </span>
                                  <span v-if="bonus_number < 1" v-bind:style='style_h'>无可用</span>
                                  <img src="../image/day.jpg" alt="">
                              </p>
                          </div>
                        <div class="shop_zong1">
                            <span>商品实付</span>
                            <span>¥{{goods_amount}}</span>
                        </div>
                        <div class="shop_zong2">
                            <span>运费</span>
                            <span>＋¥{{freight}}</span>
                            <a href="http://www.xiaomashengxian.com/huodong?id=17" target="_blank"><img src="../image/wen.png" alt=""></a>
                        </div>
                <div class="shop_zong_m" v-if="is_mm==1">
                    <span>优选会员</span>
                    <span>¥{{vip_buy_amount}}</span>
                </div>
                        <p class="invoice_details_shop" @click="get_invoice()">
                            <span>发票</span>
                            <span>{{is_invoice == 1 ? '有' : '无'}}</span>
                            <img src="../image/day.jpg" alt="">
                        </p>
                        <div class="z_price"><span>共计:<time>¥{{pay_amount}}</time> </span></div>
                        <!--非会员购物车-->
                        <div class="shop_fei" v-if="vip_list">
                             <div class="shop_fei_1">
                                 <p>开通月度会员可得<time>红包</time></p>
                                 <p>本单即可返现<time>{{vip_amount}}</time>元</p>
                                 <span>{{vip_name}}</span>
                             </div>
                             <div class="shop_fei_2" v-for="(v,index) in vip_list" @click="selectVip(index, v.id)">
                                 <p>{{v.title}} <time>¥{{v.price}}/{{v.period}}月</time></p>
                                 <p>送{{v.bonus_money}}元无门槛红包</p>
                                 <div class="shop_fei_member">
                                      <span>{{v.type}}</span>
                                 </div>
                                  <p v-bind:class="vip_id == v.id ? 'selected' : ''" ></p>
                             </div>
                            <div class="more_fei" @click="get_mem_m()">
                                <span>查看详情</span>
                            </div>
                        </div>

                      <!--会员购物车-->
                      <div class="shop_hui" v-if="! vip_list">
                          <span>{{vip_name}}</span>
                          <span>会员卡返现</span>
                          <span>¥{{vip_amount}}</span>
                          <span>每单即可享{{vip_scale}}的返现</span>
                      </div>
            </div>
        </div>
        <!--购物车跳转到订单页-->
        <div v-show="red_shop">
           <!-- <component v-bind:is="a"></component>-->
            <ul class="jie_s" v-show="!pro">
            <li>
                <span v-bind:class="rec_ids.length == all_rec_id.length ? 'radio_selected_quan' : ''" @click="checkAll()"></span>
                全选<!--{{rec_ids.length}}-{{all_rec_id.length}}-->
            </li>
            <li>合计:<span>￥{{pay_amount}}</span> </li>
            <li>
                <a v-bind:class="rec_ids.length > 0 ? 'selected' : ''" @click="addOrder()">结算</a>
            </li>
            </ul>
            <!--1-->
            <ul class="jie_s" v-show="pro">
            <li><span v-bind:class="rec_ids.length == all_rec_id.length ? 'radio_selected_quan' : ''" @click="checkAll()"></span>全选</li>
            <li @click="delCartGoods(2)">清空购物车</li>
            <li v-bind:class="rec_ids.length > 0 ? 'selected' : ''" @click="delCartGoods(1)">删除</li>
            </ul>
            <!--站位的容器-->
            <div style="height:0.83rem;width:100%;"></div>
            <!--2-->
            <div v-show="popup" class="address_2">
                <p><img src="../image/blue_cha.png" alt="" @click="disappear()">收货地址</p>
                <div class="shop2_detail_add">
                    <div class="shop2_con_detail" v-for="(v,key) in address_list">
                        <img src="../image/blue_edit.png" alt="" @click="getEdit(key)">
                        <span class="shop_ming_span" @click="selectAddress(v.id)"  v-bind:class="v.id == address_new ? 'blue_set' : ''"></span>
                        <div class="xiu_2" @click="selectAddress(v.id)"><span>{{v.consignee}}</span> <span>{{v.mobile}}</span></div>
                        <div class="xiu_3" @click="selectAddress(v.id)"><span>{{v.address}}</span></div>
                        <div class="home_mm"  v-if="v.type==1">家</div>
                        <div class="home_mm"  v-if="v.type==2">公司</div>
                      <!--  <div class="delete_m">删除</div>-->
                    </div>
                </div>
                <p></p>
               <!-- <router-link class="a_adress" to="/shop/adress" >新增地址</router-link>-->
                <a class="a_adress" @click="newZ()">新增地址</a>
            </div>
        </div>
        <!--新增收货地址-->
        <div class="add" v-show="dd">
            <div class="add_p" >
                <p><img src="../image/blue_cha.png" alt=""  v-show="this.adress_wen=='新增收货地址'?false:true" @click="close_model()">{{adress_wen}}</p>
                <p><span>收货人</span><input type="text" placeholder="填写收货人" v-model="consignee" class="int"></p>
                <p><span>收货人手机</span><input type="text" placeholder="填写手机号" v-model="mobile" class="int"></p>
                <p @click="pp()"><span>所在地区</span ><span id="sel_city"></span><img src="../image/day.jpg" alt="" id="img_te"></p>
                <p><span>详情地址</span><input type="text" placeholder="详情地址" v-model="address" class="int"></p>
                <p>
                    <span class="s_l">类型<span>(选填)</span></span>
                    <span class="s_l1">
                        <span id="span_3" @click="selectArType(1)" v-bind:class="[act4]">家</span>
                        <span id="span_4" @click="selectArType(2)" v-bind:class="[act5]">公司</span>
                    </span>
                </p>
            </div>
            <div class="a_click" id="a_click">
                <button @click="addAddress(key)">保存并使用</button>
            </div>

        </div>
        <!--地址选择弹窗-->
      <div class="back_c" v-show="back1" @click="getL()"></div>
        <!--选择结束-->

        <!--新增的红包页面-->
        <div class="red_m" v-show="red_n">
               <div class="red_1" @click="get_mm()">
                   <img src="../image/blue_da.png" alt="">
                   <h4>红包</h4>
               </div>
                <div class="red_2">
                    不使用红包
                    <span v-bind:class="bonus_id == 0 ? 'selected' : ''" @click="selectBonus(0, 0)"></span>
                </div>
               <div class="red_3">
                   <p class="red_3_p">红包不能多个使用</p>
                   <div class="red_4" v-for="v in bonus_list" @click="selectBonus(v.bonus_id, v.face_value)">
                       <p>小马生鲜元{{parseFloat(v.face_value)}}红包</p>
                       <p>{{v.face_value >= v.restrict_amount ? '无门槛使用' : '满' + v.restrict_amount + '元可用'}}</p>
                       <p>劲爆低价商品不能使用</p>
                       <p>会员非会员通道</p>
                       <p v-show="v.is_soon">即将过期</p>
                       <p>有效期至:{{v.expire_time}}</p>
                       <p>¥{{parseFloat(v.face_value)}}</p>
                       <span v-bind:class="bonus_id == v.bonus_id ? 'selected' : ''" ></span>
                   </div>
               </div>
           </div>
    </div>

</template>
<script>
    export default {
        name:'shop',
        data(){
            return{
                show_y:{
                    color:'#fd71c3'
                },
                style_h:{
                    color:'#bfbfbf'
                },
                add_list1:[],
                adress_wen:'新增收货地址',
                act4:'',
                act5:'',
                back1:false,
                dd:false,
                pro:false,
                popup:false,
                edit:"编辑",
                a:'first',
                prese:false,
                cart_list:[],
                address_line:[],
                /*修改编辑的地址*/
                address:[],
                all_rec_id:[],
                rec_ids:[],
                all_weight:0,
                all_amount:0,
                /*地址循环的列表*/
                address_list:[],


                vip_id:0,
                bonus_id:0,
                bonus_amount:0,

                bonus_number:0,
                freight:0,
                gift_infos:[],
                try_infos:[],
                discount_infos:[],
                whole_discount:[],
                goods_amount:0,
                pay_amount:0,
                vip_amount:0,
                vip_list:[],
                vip_name:'',
                vip_scale:'',
                vip_buy_amount:0,

                bonus_list:[],

                // 地址添加的相关字段
                province:'',
                city:'',
                district:'',
                consignee:'',
                address_1:'',
                mobile:'',
                type:'',
                selectedIndex:[0, 0, 0],
                /*判断是保存还是编辑的字段*/
                is_new:true,
                //新增红包的字段
                red_n:false,
                red_shop:true,
                /*新添加的地址字段*/
                address_new:'',
                key:0,
                is_invoice : 0,
                /*保存新更新的数组*/
                arr_new:[],
                /*删除商品的字段*/
                pro_1:true,
                /*设置默认会员显示*/
                is_mm:1,
            }
        },
        mounted:function(){
            /*input聚焦的方法*/
            this.get_foucs();
            /*红包的容器*/
            let HH=$(window).height();
            $('.red_m').height(HH);

            //48
            let H = $(window).height()-56;
            $('.shop_te').height(H);

            let is_invoice = this.GLOBAL.getCookie('is_invoice');
            this.is_invoice = is_invoice > 0 ? is_invoice : 0;
            /*请求整个商品的信息*/
            this.$http.jsonp(
                this.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=cartList',
                {
                    params: {
                        uid:this.GLOBAL.getCookie('uid'),
                        time:this.GLOBAL.getCookie('time'),
                        token:this.GLOBAL.getCookie('token'),
                        session_id:this.GLOBAL.getCookie('user_cart_id')
                    },
                    jsonp:'callback'
                }
            ).then(function (res) {
                if (res.body.code != 200) {
                    alert(res.body.msg);
                    return false;
                }

                this.cart_list = res.body.data.cart_list;
                this.address_line = res.body.data.address_line;
                this.all_rec_id = res.body.data.rec_ids;
                this.rec_ids = res.body.data.rec_ids.slice(0);
                this.all_weight = res.body.data.all_weight;
                this.all_amount = res.body.data.all_amount;
                this.bonus_number = res.body.data.bonus_number;
                this.freight = res.body.data.freight;
                this.gift_infos = res.body.data.gift_infos;
                this.try_infos = res.body.data.try_infos;
                this.discount_infos = res.body.data.discount_infos;
                this.whole_discount = res.body.data.whole_discount;
                this.goods_amount = res.body.data.goods_amount;
                this.pay_amount = res.body.data.pay_amount;
                this.vip_amount = res.body.data.vip_amount;
                this.vip_list = res.body.data.vip_list;
                this.vip_name = res.body.data.vip_name;
                this.vip_scale = res.body.data.vip_scale;

                /*初始状态默认地址*/
                if(this.address_line.id){
                    this.address_new=this.address_line.id;
                }

                //获取红包列表
                this.get_bonus_list();
                /*默认选中添加会员*/
                this.vip_id       =  this.vip_list[0].id;
                this.vip_buy_amount   =  this.vip_list[0].price;

                var pay_amount = parseFloat(this.pay_amount) * 100;
                var vip_buy_amount = parseFloat(this.vip_buy_amount) * 100;
                this.pay_amount = ((pay_amount + vip_buy_amount) / 100).toFixed(2);
            });


        },
        methods:{
           /*监控input的点击事件*/
           get_foucs:function(){
               var objList =$(".int");
               for ( var i = 0 ; i< objList.length ; i++ )
               {
                   if ( objList[i].type == "text" ||  objList[i].type == "textarea" || objList[i].type == "password"  )
                   {
                       if ( objList[i].disabled != true )
                       {
                           objList[i].focus();
                           return false;
                       }
                   }
               }
           },
            /*跳转到会员购买页*/
            get_mem_m:function(){
                this.$router.push('/member_right')
            },
            /*发票选择*/
            get_invoice:function(){
                this.GLOBAL.setCookie('pay_amount', this.pay_amount);
                this.$router.push('/my_invoice');
            },
            /*返回购物车*/
            get_mm:function(){
                this.red_n=false;
                this.red_shop=true;
            },
            /*红包列表*/
            get_bonus_list:function(){
                this.$http.jsonp(
                    this.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=getBonus',
                    {
                        params:{
                            goods_amount:this.goods_amount,
                            uid:this.GLOBAL.getCookie('uid'),
                            time:this.GLOBAL.getCookie('time'),
                            token:this.GLOBAL.getCookie('token'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {
                    if (res.body.code != 200) {
                        alert(res.body.msg);
                        return false;
                    }
                    //
                    this.bonus_list = res.body.data.bonus_list;
                    if(this.bonus_list.length){
                        let bonus_id       =  this.bonus_list[0].bonus_id;
                        let bonus_amount   =  this.bonus_list[0].face_value;
                        this.selectBonus(bonus_id, bonus_amount);
                    }
                   
                });
            },
            /*显示红包列表*/
            get_show_red:function(){
                if (this.bonus_number < 1) {
                    return false;
                }
              
                this.red_n=true;
                this.red_shop=false;
            },

            close_model:function(){
                this.back1=false;
                this.dd=false;
            },

            // 选择红包
            selectBonus:function (id, amount) {
                var goods_amount = parseFloat(this.goods_amount) * 100;
                var pay_amount = parseFloat(this.pay_amount) * 100;
                var old_amount = parseFloat(this.bonus_amount) * 100;
                var new_amount = parseFloat(amount) * 100;

                this.pay_amount   = ((pay_amount + old_amount - new_amount) / 100).toFixed(2);
                this.goods_amount = ((goods_amount + old_amount - new_amount) / 100).toFixed(2);

                this.bonus_id = id;
                this.bonus_amount = amount;
                this.red_n=false;
                this.red_shop=true;
            },

            /*点击编辑修改地址*/
            getEdit:function(key){
                this.is_new = false;

                this.dd=true;
                this.key=key;
                this.popup = false;
                this.adress_wen='编辑修改地址';
                this.$http.jsonp(
                    this.GLOBAL.BaseUrl+'/mobile/api/v1/Address.php?mode=save',
                    {
                        params: {
                            address_id: this.address_list[key].id,
                            uid:this.GLOBAL.getCookie('uid'),
                            time:this.GLOBAL.getCookie('time'),
                            token:this.GLOBAL.getCookie('token'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {

                    this.address_1 = res.body.data.address;
                    this.add_list1= this.address_1;
                    this.consignee= this.add_list1.consignee;
                    this.mobile=this.add_list1.mobile;
                    this.address=this.add_list1.address;
                    this.selectArType(this.add_list1.type);
                    $('#sel_city').text(this.add_list1.province+this.add_list1.city+this.add_list1.district);

                    //初始化地址
                    this.province = this.add_list1.province;
                    this.city = this.add_list1.city;
                    this.district = this.add_list1.district;
                });

                this.address_city();

                this.add_list1=[];

            },
            /*全选弹框的消失*/
            getL:function(){
                if(this.popup=true){
                    this.back1=false;
                    this.popup=false;
                };
                if(this.dd=true){
                    this.back1=false;
                    this.dd=false;
                }
            },
            address_city:function(){
                //console.log(city);
                let arr = [];
                for(var i in city){
                    if(city[i]['name'] == this.province){
                        arr.push(i);

                        let sub = city[i]['sub'];
                        for(var i2 in sub){
                             if(sub[i2]['name'] == this.city){
                                arr.push(i2);

                                let sub2 = sub[i2]['sub'];
                                for(var i3 in sub2){
                                     if(sub2[i3]['name'] == this.district){
                                        arr.push(i3); 
                                     }
                                }
                            }
                        }
                    }
                }
                this.selectedIndex = arr;
            },
            /*选择地址代码*/
            pp:function(){
                var obj = this;
               /* this.back1=false;*/
                var nameEl = document.getElementById('sel_city');

                var first = []; /* 省，直辖市 */
                var second = []; /* 市 */
                var third = []; /* 镇 */

                if(this.is_new){
                    var selectedIndex = [0,0,0]; /* 默认选中的地区 */
                }else{
                    var selectedIndex = this.selectedIndex; /* 默认选中的地区 */
                }

                var checked = [0, 0, 0]; /* 已选选项 */

                function creatList(obj, list){
                    obj.forEach(function(item, index, arr){
                        var temp = new Object();
                        temp.text = item.name;
                        temp.value = index;
                        list.push(temp);
                    })
                }
                creatList(city, first);
                if (city[selectedIndex[0]].hasOwnProperty('sub')) {
                    creatList(city[selectedIndex[0]].sub, second);
                } else {
                    second = [{text: '', value: 0}];
                }

                if (city[selectedIndex[0]].sub[selectedIndex[1]].hasOwnProperty('sub')) {
                    creatList(city[selectedIndex[0]].sub[selectedIndex[1]].sub, third);
                } else {
                    third = [{text: '', value: 0}];
                }

                var picker = new Picker({
                    data: [first, second, third],
                    selectedIndex: selectedIndex,
                    title: '地址选择'
                });

                picker.on('picker.select', function (selectedVal, selectedIndex) {
                    var text1 = first[selectedIndex[0]].text;
                    var text2 = second[selectedIndex[1]].text;
                    var text3 = third[selectedIndex[2]] ? third[selectedIndex[2]].text : '';

                  
                    /*地址弹窗选中拿到的地址*/
                    obj.province = text1;
                    obj.city = text2;
                    obj.district = text3;

                    nameEl.innerText = text1 + ' ' + text2 + ' ' + text3;
                });

                picker.on('picker.change', function (index, selectedIndex) {
                    if (index === 0){
                        firstChange();
                    } else if (index === 1) {
                        secondChange();
                    }

                    function firstChange() {
                        second = [];
                        third = [];
                        checked[0] = selectedIndex;
                        var firstCity = city[selectedIndex];
                        if (firstCity.hasOwnProperty('sub')) {
                            creatList(firstCity.sub, second);

                            var secondCity = city[selectedIndex].sub[0]
                            if (secondCity.hasOwnProperty('sub')) {
                                creatList(secondCity.sub, third);
                            } else {
                                third = [{text: '', value: 0}];
                                checked[2] = 0;
                            }
                        } else {
                            second = [{text: '', value: 0}];
                            third = [{text: '', value: 0}];
                            checked[1] = 0;
                            checked[2] = 0;
                        }

                        picker.refillColumn(1, second);
                        picker.refillColumn(2, third);
                        picker.scrollColumn(1, 0)
                        picker.scrollColumn(2, 0)
                    }

                    function secondChange() {
                        third = [];
                        checked[1] = selectedIndex;
                        var first_index = checked[0];
                        if (city[first_index].sub[selectedIndex].hasOwnProperty('sub')) {
                            var secondCity = city[first_index].sub[selectedIndex];
                            creatList(secondCity.sub, third);
                            picker.refillColumn(2, third);
                            picker.scrollColumn(2, 0)
                        } else {
                            third = [{text: '', value: 0}];
                            checked[2] = 0;
                            picker.refillColumn(2, third);
                            picker.scrollColumn(2, 0)
                        }
                    }

                });

                picker.on('picker.valuechange', function (selectedVal, selectedIndex) {
                  //  console.log(selectedVal);
                   // console.log(selectedIndex);
                });
               /* nameEl.addEventListener('click', function () {*/
                    picker.show();
               /* });*/
            },
            /*保存新增地址*/
            newZ:function(){
                this.is_new= true;
                this.dd=!this.dd;
                this.popup=false;
                this.back1=true;
                this.adress_wen='新增收货地址';
                this.add_list1=[];
                this.consignee= '';
                this.mobile='';
                this.address='';
                $('#sel_city').text('');
                this.selectArType(0);
            },
            add:function(){
                this.dd=!this.dd;
                this.popup=false;
            },
            /*获取列表里面的所有选择地址*/
            addressShow:function () {
                if(this.popup==false){
                        this.$http.jsonp(
                            this.GLOBAL.BaseUrl+'/mobile/api/v1/Address.php?mode=index',
                            {
                                params: {
                                    uid:this.GLOBAL.getCookie('uid'),
                                    time:this.GLOBAL.getCookie('time'),
                                    token:this.GLOBAL.getCookie('token'),
                                },
                                jsonp:'callback'
                            }
                        ).then(function (res) {
                            if (res.body.code == 201) {
                                this.GLOBAL.setCookie('logined_url', window.location.pathname + window.location.search);
                                this.$router.push('/login');
                                return false;
                            }

                            if (res.body.code != 200) {
                                alert(res.body.msg);
                                return false;
                            }

                            this.address_list = res.body.data.address_list;

                        });

                    this.popup=true;
                    this.back1=true;
                }else{
                    this.popup=false;
                    this.back1=false;
                }
            },
            
            disappear:function () {
                this.popup=false;
                this.back1=false;
            },

            complete:function(){
                if (this.pro==false) {
                    this.edit='完成'
                    this.pro=!this.pro
                } else {
                    this.pro=!this.pro
                    this.edit='编辑'
                }
            },
            getShop:function(){
                window.history.go(-1)
            },

            // 选择购物车商品切换选中商品还是取消商品
            choice:function (rec_id) {
                let that=this;
                if (that.GLOBAL.isInArray(rec_id, that.rec_ids)) {
                    that.rec_ids = that.GLOBAL.removeByValue(that.rec_ids, rec_id);
                } else {
                    that.rec_ids.push(rec_id);
                }

                that.$http.jsonp(
                    that.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=allGoodsAmount',
                    {
                        params:{
                            rec_ids:that.rec_ids,
                            uid:that.GLOBAL.getCookie('uid'),
                            time:that.GLOBAL.getCookie('time'),
                            token:that.GLOBAL.getCookie('token'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {
                    if (res.body.code != 200) {
                        alert(res.body.msg);
                    } else {
                        that.discount_infos = res.body.data.discount_infos;
                        that.whole_discount = res.body.data.whole_discount;
                        that.gift_infos = res.body.data.gift_infos;
                        that.try_infos = res.body.data.try_infos;
                        that.all_amount = res.body.data.all_amount;
                        that.all_weight = res.body.data.all_weight;
                        that.freight = res.body.data.freight;
                        that.goods_amount = res.body.data.goods_amount;
                        that.bonus_number = res.body.data.bonus_number;
                        that.pay_amount = res.body.data.pay_amount + parseFloat(this.vip_buy_amount);
                        that.vip_amount = res.body.data.vip_amount;
                        that.bonus_list = [];
                        that.bonus_id = 0;
                        that.bonus_amount = 0;
                    }
                });
            },

            // 全选
            checkAll:function () {
                if (this.rec_ids.length == this.all_rec_id.length) {
                    this.rec_ids = [];
                    this.all_amount = 0;
                    this.all_weight = 0;
                    this.bonus_number=0;
                    this.freight=0;
                    this.gift_infos=[];
                    this.try_infos=[];
                    this.discount_infos=[];
                    this.whole_discount=[];
                    this.goods_amount=0;
                    this.pay_amount=0;
                    this.vip_amount=0;
                    this.bonus_list = [];
                    this.bonus_id = 0;
                    this.bonus_amount = 0;
                } else {
                    this.rec_ids = this.all_rec_id.slice(0);

                    this.$http.jsonp(
                        this.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=allGoodsAmount',
                        {
                            params:{
                                rec_ids:this.rec_ids,
                                uid:this.GLOBAL.getCookie('uid'),
                                time:this.GLOBAL.getCookie('time'),
                                token:this.GLOBAL.getCookie('token'),
                            },
                            jsonp:'callback'
                        }
                    ).then(function (res) {
                        if (res.body.code != 200) {
                            alert(res.body.msg);
                        } else {
                            this.discount_infos = res.body.data.discount_infos;
                            this.whole_discount = res.body.data.whole_discount;
                            this.gift_infos = res.body.data.gift_infos;
                            this.try_infos = res.body.data.try_infos;
                            this.all_amount = res.body.data.all_amount;
                            this.all_weight = res.body.data.all_weight;
                            this.freight = res.body.data.freight;
                            this.goods_amount = res.body.data.goods_amount;
                            this.bonus_number = res.body.data.bonus_number;
                            this.pay_amount = res.body.data.pay_amount + parseFloat(this.vip_buy_amount);
                            this.vip_amount = res.body.data.vip_amount;
                            this.bonus_list = [];
                            this.bonus_id = 0;
                            this.bonus_amount = 0;
                        }
                    });
                }
            },
            
            // 更改商品数量
            saveNumber:function (arr, type) {
                var obj = document.getElementById('save_num_' + arr.rec_id);
                if (obj.getAttribute("data") != 1) {
                    return false;
                }
                obj.setAttribute("data", 2);
                var number = parseInt(arr.goods_number);
                if (type == 1) {
                    if (arr.goods_number > 1) {
                        number -= 1;
                    } else {
                        obj.setAttribute("data", 1);
                        return false;
                    }
                } else {
                    number += 1;
                }
                this.$http.jsonp(
                    this.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=saveCartGoodsNum',
                    {
                        params:{
                            rec_id:arr.rec_id,
                            rec_ids:this.rec_ids,
                            goods_num:number,
                            uid:this.GLOBAL.getCookie('uid'),
                            time:this.GLOBAL.getCookie('time'),
                            token:this.GLOBAL.getCookie('token'),
                            session_id:this.GLOBAL.getCookie('user_cart_id'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {
                    if (res.body.code != 200) {
                        alert(res.body.msg);
                    } else {
                        if (res.body.data.amount_data) {
                            arr.goods_number = res.body.data.goods_num;

                            this.discount_infos = res.body.data.amount_data.discount_infos;
                            this.whole_discount = res.body.data.amount_data.whole_discount;
                            this.gift_infos = res.body.data.amount_data.gift_infos;
                            this.try_infos = res.body.data.amount_data.try_infos;
                            this.all_amount = res.body.data.amount_data.all_amount;
                            this.all_weight = res.body.data.amount_data.all_weight;
                            this.freight = res.body.data.amount_data.freight;
                            this.goods_amount = res.body.data.amount_data.goods_amount;
                            this.bonus_number = res.body.data.amount_data.bonus_number;
                            this.pay_amount = res.body.data.amount_data.pay_amount + parseFloat(this.vip_buy_amount);
                            this.vip_amount = res.body.data.amount_data.vip_amount;
                            this.bonus_list = [];
                            this.bonus_id = 0;
                            this.bonus_amount = 0;
                        }
                    }
                    obj.setAttribute("data", 1);
                });
            },
            //删除单个商品的列表方法
            delCart:function(rec_id){
                var rec_ids = [rec_id];
                var that=this;
                that.$http.jsonp(
                    that.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=deleteCartGoods',
                    {
                        params:{
                            rec_ids:rec_ids,
                            uid:that.GLOBAL.getCookie('uid'),
                            time:that.GLOBAL.getCookie('time'),
                            token:that.GLOBAL.getCookie('token'),
                            session_id:that.GLOBAL.getCookie('user_cart_id'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {
                    if (res.body.code != 200) {
                        alert(res.body.msg);
                    } else {
                        var arr = that.cart_list;
                        that.GLOBAL.removeByValue(that.all_rec_id, rec_id);
                        that.GLOBAL.removeByValue(that.rec_ids, rec_id);
                        arr[ rec_id ] = '';
                        var cart_list = {};
                        for (var k in arr) {
                            if (arr[k]) {
                                cart_list[k] = arr[k];
                            }
                        }
                        that.cart_list = cart_list;
                       // alert(that.rec_ids.lenth)
                        if (that.GLOBAL.arrayCount(that.rec_ids) > 0) {
                            //alert(that.rec_ids.lenth)
                            that.$http.jsonp(
                                that.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=allGoodsAmount',
                                {
                                    params:{
                                        rec_ids:that.rec_ids,
                                        uid:that.GLOBAL.getCookie('uid'),
                                        time:that.GLOBAL.getCookie('time'),
                                        token:that.GLOBAL.getCookie('token'),
                                    },
                                    jsonp:'callback'
                                }
                            ).then(function (res) {
                                if (res.body.code != 200) {
                                    alert(res.body.msg);
                                } else {
                                    that.discount_infos = res.body.data.discount_infos;
                                    that.whole_discount = res.body.data.whole_discount;
                                    that.gift_infos = res.body.data.gift_infos;
                                    that.try_infos = res.body.data.try_infos;
                                    that.all_amount = res.body.data.all_amount;
                                    that.all_weight = res.body.data.all_weight;
                                    that.freight = res.body.data.freight;
                                    that.goods_amount = res.body.data.goods_amount;
                                    that.bonus_number = res.body.data.bonus_number;
                                    that.pay_amount = res.body.data.pay_amount + parseFloat(this.vip_buy_amount);
                                    that.vip_amount = res.body.data.vip_amount;
                                    that.bonus_list = [];
                                    that.bonus_id = 0;
                                    that.bonus_amount = 0;
                                }
                            });
                        } else {
                            that.all_amount = 0;
                            that.all_weight = 0;
                            that.bonus_number = 0;
                            that.freight = 0;
                            that.gift_infos = [];
                            that.try_infos = [];
                            that.discount_infos = [];
                            that.whole_discount = [];
                            that.goods_amount = 0;
                            that.pay_amount = 0;
                            that.vip_amount = 0;
                            that.bonus_list = [];
                            that.bonus_id = 0;
                            that.bonus_amount = 0;
                            /*this.vip_buy_amount = 0;*/
                        }
                    }
                });
            },
            // 删除购物车商品
            delCartGoods:function (type) {
                var is_all = type == 2 ? true : false;
                var rec_ids = type == 2 ? this.all_rec_id : this.rec_ids;
                if (type == 1) {
                    if (this.rec_ids.length == this.all_rec_id.length) {
                        is_all = true;
                    }
                }
                //alert(is_all);return;
                this.$http.jsonp(
                    this.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=deleteCartGoods',
                    {
                        params:{
                            rec_ids:rec_ids,
                            uid:this.GLOBAL.getCookie('uid'),
                            time:this.GLOBAL.getCookie('time'),
                            token:this.GLOBAL.getCookie('token'),
                            session_id:this.GLOBAL.getCookie('user_cart_id'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {
                    if (res.body.code != 200) {
                        alert(res.body.msg);
                    } else {
                        if (is_all) {
                            this.cart_list = [];
                            this.all_rec_id = [];
                        } else {
                            var arr = this.cart_list;
                            for (var k in this.rec_ids) {
                                this.GLOBAL.removeByValue(this.all_rec_id, this.rec_ids[k]);
                                arr[ this.rec_ids[k] ] = '';
                            }
                            var cart_list = {};
                            for (var k in arr) {
                                if (arr[k]) {
                                    cart_list[k] = arr[k];
                                }
                            }
                            this.cart_list = cart_list;
                        }

                        this.rec_ids = [];
                        this.all_amount = 0;
                        this.all_weight = 0;
                        this.bonus_number = 0;
                        this.freight = 0;
                        this.gift_infos = [];
                        this.try_infos = [];
                        this.discount_infos = [];
                        this.whole_discount = [];
                        this.goods_amount = 0;
                        this.pay_amount = 0;
                        this.vip_amount = 0;
                        this.bonus_list = [];
                        this.bonus_id = 0;
                        this.bonus_amount = 0;
                        /*this.vip_buy_amount = 0;*/

                        //this.pro=!this.pro;
                        this.edit='编辑';

                        /*if (rec_id) {
                            this.checkAll();
                        }*/
                    }
                });
            },

            // 跳转结算页
            addOrder:function () {
                if (this.rec_ids.length > 0) {
                    if(parseInt(this.pay_amount) < 20){
                        alert("实付金额满20元起送!");return;
                    }
                    this.GLOBAL.setCookie('logined_url', window.location.pathname + window.location.search);   /*这里是测试使用一会要把他*/
                    var data = {rec_ids:this.rec_ids};
                    if (this.vip_id) data.vip_id = this.vip_id;
                    if (this.bonus_id) data.bonus_id = this.bonus_id;
                    this.$router.push({path:'/details', query:data});
                    /*shop/adress/details*/
                }

                return false;
            },
            /*选择地址栏的地址*/
            selectAddress:function (id) {
                this.$http.jsonp(
                    this.GLOBAL.BaseUrl+'/mobile/api/v1/Address.php?mode=get_line',
                    {
                        params:{
                            address_id:id,
                            uid:this.GLOBAL.getCookie('uid'),
                            time:this.GLOBAL.getCookie('time'),
                            token:this.GLOBAL.getCookie('token'),
                        },
                        jsonp:'callback'
                    }
                ).then(function (res) {
                    if (res.body.code == 201) {
                        this.GLOBAL.setCookie('logined_url', window.location.pathname + window.location.search);
                        this.$router.push('/login');
                        return false;
                    }

                    if (res.body.code != 200) {
                        alert(res.body.msg);
                        return false;
                    }
                    this.address_line = res.body.data.address_line;
                    /*判断默认状态添加选中地址功能*/

                   this.address_new = id;
                  /* this.GLOBAL.setCookie('ad',0)*/

                    this.address_new = this.address_line.id;

                    //切换
                    this.address_me();

                    this.popup=false;
                    this.back1=false;
                });              
            },
            //地址价格检测 
            address_me(){
                //切换
                let address =  this.address_line.address;
                let price   =  this.pay_amount-this.freight;

                this.$http.jsonp(this.GLOBAL.BaseUrl+'/mobile/api/v1/Flow.php?mode=getPosition',{params: {address:address,price:price},jsonp:'callback'}
                ).then(function (res) {
                    let temp =  res.body.data;
                    if(res.body.code == 200){   
                        this.pay_amount = temp.pay_amount;
                        this.freight    = temp.freight;
                    }
                });
            },
            // 选择配送地址类型
            selectArType:function (type) {
                this.type = type;
                this.act4='';
                this.act5='';
                if(this.type == 1){
                    this.act4 = 'showY';
                };
                if(this.type == 2){
                    this.act5='showY'
                }
            },

            // 保存配送地址
            addAddress:function (key) {
                if (! (this.province && this.city && this.district && this.consignee && this.address && this.mobile && this.type)) {
                    alert('地址请填写完整！');
                    return false;
                }

                if(this.mobile.length!=11) {
                    alert('请输入有效的手机号码！');
                    return false;
                }

                var myreg = /^(((13[\d]{1})|(14[5,7]{1})|(15[^4]{1})|(17[0,6,7,8]{1})|(18[\d]{1}))+\d{8})$/;
                if(!myreg.test(this.mobile)) {
                    alert('请输入有效的手机号码！');
                    return false;
                }
                if(this.is_new==true){
                    this.$http.jsonp(
                        this.GLOBAL.BaseUrl+'/mobile/api/v1/Address.php?mode=insert',
                        {
                            params: {
                                province:this.province,
                                city:this.city,
                                district:this.district,
                                consignee:this.consignee,
                                address:this.address,
                                mobile:this.mobile,
                                type:this.type,
                                uid:this.GLOBAL.getCookie('uid'),
                                time:this.GLOBAL.getCookie('time'),
                                token:this.GLOBAL.getCookie('token'),
                            },
                            jsonp:'callback'
                        }
                    ).then(function (res) {
                        if (res.body.code == 201) {
                            this.GLOBAL.setCookie('logined_url', window.location.pathname + window.location.search);
                            this.$router.push('/login');
                            return false;
                        }

                        if (res.body.code != 200) {
                            alert(res.body.msg);
                            return false;
                        }
                        this.address_line=res.body.data.address;
                        /*立即跟新数组里面地址列表*/
                        this.address_list.unshift(this.address_line);
                        //this.arr_new=this.address_list;//把新更新的一个数组变成一个新的数组
                        /*调用默认选中地址的方法*/
                        this.selectAddress(res.body.data.address.address_id);
                        this.prese = true;
                        this.dd = false;
                        this.back1=false;
                    });
                }else{
                    this.$http.jsonp(
                        this.GLOBAL.BaseUrl+'/mobile/api/v1/Address.php?mode=update',
                        {
                            params: {
                                province:this.province,
                                city:this.city,
                                district:this.district,
                                consignee:this.consignee,
                                address:this.address,
                                mobile:this.mobile,
                                type:this.type,
                                uid:this.GLOBAL.getCookie('uid'),
                                time:this.GLOBAL.getCookie('time'),
                                token:this.GLOBAL.getCookie('token'),
                                address_id:this.address_list[key].id,
                            },
                            jsonp:'callback'
                        }
                    ).then(function(res){
                        this.address_line=res.body.data.address;
                        /*立即跟新数组里面地址列表*/
                       this.address_list.unshift(this.address_line);
                        //this.arr_new=this.address_list;//把新更新的一个数组变成一个新的数组
                        /*调用默认选中地址的方法*/
                        this.selectAddress(res.body.data.address.address_id);
                        this.prese = true;
                        this.dd = false;
                        this.back1=false;
                    })
                }
                /*调用编辑地址的接口*/

            },

            //选择会员
            selectVip:function (index, id) {
                var pay_amount = parseFloat(this.pay_amount) * 100;
                var vip_buy_amount = parseFloat(this.vip_buy_amount) * 100;
                if(this.vip_id == id){
                    this.vip_id=0;
                    this.vip_buy_amount=0;
                    this.pay_amount = ((pay_amount - vip_buy_amount) / 100).toFixed(2);
                    this.is_mm='';
                }
                else{
                    this.vip_buy_amount = this.vip_list[index].price;
                    var new_vip_buy_amount = parseFloat(this.vip_buy_amount) * 100;
                    this.pay_amount = ((pay_amount - vip_buy_amount + new_vip_buy_amount) / 100).toFixed(2);
                    this.vip_id = id;
                    this.is_mm=1;
                }
            }
        }
    }
</script>
<style>
    .shop_zong_m span:nth-of-type(1){
        display:block;
        width:1.76rem;
        height:0.79rem;
        float:left;
        line-height:0.79rem;
        color:#494848;
        font-size:0.26rem;
        text-indent: 0.2rem;
    }
    .shop_zong_m span:nth-of-type(2){
        height:0.79rem;
        float:right;
        color:#fd71c3;
        font-size:0.24rem;
        line-height:0.79rem;
        display:block;
        margin-right:0.2rem;
    }
    .shop_zong_m{
        width:100%;
        height:0.79rem;
        border-bottom:0.01rem solid #f0f0f0;
    }
    /*会员价格*/
    .del_m{
        display:block;
        height:0.4rem;
        width:0.4rem;
        position:absolute;
        top:0.4rem;
        left:1.38rem;
    }
   /* .delete_m{
        height:0.8rem;
        width:1rem;
        background:red;
        color:#ffffff;
        line-height:0.8rem;
        text-align:center;
        font-size:0.24rem;
        position:absolute;
        top: 0.6rem;
        right: 0.3rem;
    }*/
    /*删除地址样式*/
    .shop_cj{
        width:100%;
        height:0.8rem;
        position:fixed;
        background:#ffffff;
        z-index:1;
        top:0;
        left:0;
    }
    .picker .picker-panel .picker-choose .confirm{
        color: #74c3fd;
    }
    .blue_set{
        background:url(../image/blue_2.jpg) no-repeat;
        background-size: contain;
    }
    .home_mm{
        height:0.32rem;
        width:0.62rem;
        border:0.01rem solid #fc1dac;
        line-height:0.32rem;
        text-align:center;
        font-size:0.2rem;
        position:absolute;
        border-radius:0.05rem;
        top: .4rem;
        left: 3.5rem;
        color:#fc1dac;
    }
/*添加选中地址的样式*/
#span_3{
    display:block;
    width:0.74rem;
    height:0.3rem;
    color:#909090;
    font-size:0.2rem;
    line-height:0.3rem;
    text-align:center;
    border-radius:0.05rem;
    position:absolute;
    top:0.25rem;
   /* left:0.2rem;*/
    border:0.01rem solid #dedede;
}
#span_4{
    position:absolute;
    border:0.01rem solid #dedede;
    top:0.25rem;
    left:0.9rem;
    display:block;
    width:0.74rem;
    height:0.3rem;
    color:#909090;
    font-size:0.2rem;
    line-height:0.3rem;
    text-align:center;
    border-radius:0.05rem;
}
    /*新增红包页面*/
    .shop_hui{
        height:0.9rem;
        width:100%;
        padding-top:0.2rem;
        position:relative;

    }
    .shop_hui span:nth-of-type(4){
        height:0.32rem;
        float:right;
        color:#848484;
        font-size:0.24rem;
        line-height:0.32rem;
        display:block;
        /*margin-right:0.2rem;*/
        position:absolute;
        top:0.53rem;
        right:0.2rem;
    }
    .shop_hui span:nth-of-type(3){
        height:0.34rem;
        float:right;
        color:#fd71c3;
        font-size:0.24rem;
        line-height:0.34rem;
        display:block;
        margin-right:0.2rem;
    }
    .shop_hui span:nth-of-type(2){
        display:block;
        height:0.66rem;
        width:1.65rem;
        color:#545454;
        font-size:0.24rem;
        line-height:0.66rem;
        text-align:center;
        position:absolute;
        top:0.2rem;
        left:1.38rem;
    }
    .shop_hui span:nth-of-type(1){
        position:absolute;
        display:block;
        width:1.18rem;
        height:0.35rem;
        line-height:0.35rem;
        color:#8b7527;
        font-size:0.22rem;
        border-radius:0.5rem;
        text-align:center;
        background: -webkit-linear-gradient(left, #feeda0 , #ffd882); /* Safari 5.1 - 6.0 */
        background: -o-linear-gradient(right, #feeda0, #ffd882); /* Opera 11.1 - 12.0 */
        background: -moz-linear-gradient(right,  #feeda0, #ffd882); /* Firefox 3.6 - 15 */
        background: linear-gradient(to right, #feeda0, #ffd882); /* 标准的语法（必须放在最后） */
        top:0.33rem;
        left:0.1rem;
    }

    /*会员购物车*/
    .more_fei span{
        display:block;
        height:0.5rem;
        width:1.32rem;
        line-height:0.5rem;
        text-align:center;
        color:#cecece;
        font-size:0.26rem;
        margin:auto;
        border:0.01rem solid #dedede;
        border-radius:0.05rem;
    }
    .more_fei{
        width:100%;
        height:0.8rem;
        padding-top: 0.22rem;
    }
    .shop_fei_member span{
        display:block;
        height:0.28rem;
        width:0.44rem;
        font-size:0.18rem;
        color:#ffffff;
        line-height:0.28rem;
        text-align:center;
        border-radius:0.05rem;
        background: -webkit-linear-gradient(left, #feeda0 , #ffd882); /* Safari 5.1 - 6.0 */
        background: -o-linear-gradient(right, #feeda0, #ffd882); /* Opera 11.1 - 12.0 */
        background: -moz-linear-gradient(right,  #feeda0, #ffd882); /* Firefox 3.6 - 15 */
        background: linear-gradient(to right, #feeda0, #ffd882); /* 标准的语法（必须放在最后） */
    }
    .shop_fei_member{
        height:0.5rem;
        width:0.6rem;
        border:0.01rem solid #e8e8e8;
        position:absolute;
        left:0.1rem;
        top:0.15rem;
        border-radius:50%;
        padding-top:0.2rem;
        padding-left:0.1rem;
    }
    .shop_fei_2{
        width:100%;
        height:0.85rem;
        border-bottom:0.01rem solid #f0f0f0;
        padding-top:0.14rem;
        position:relative;
    }
    .shop_fei_2 p:nth-of-type(3){
        height:0.36rem;
        width:0.36rem;
        border:0.01rem solid #d2d1cf;
        position:absolute;
        top:0.34rem;
        right:0.26rem;
        border-radius:50%;
    }
    .shop_fei_2 p:nth-of-type(3).selected{
        background:url(../image/blue_2.jpg) no-repeat;
        background-size: contain;
    }
    .shop_fei_2 p:nth-of-type(1){
        height:0.35rem;
        line-height:0.35rem;
        text-indent: 1.73rem;
        color:#545454;
        font-size:0.22rem;
    }
    .shop_fei_2 p:nth-of-type(1) time{
        font-weight:700;
    }
    .shop_fei_2 p:nth-of-type(2){
        height:0.35rem;
        line-height:0.35rem;
        text-indent: 1.73rem;
        color:#a6a6a6;
        font-size:0.22rem;
    }
    /*月卡*/
    .shop_fei_1 p{
        height:0.35rem;
        line-height:0.35rem;
       text-indent: 1.73rem;
        color:#545454;
        font-size:0.22rem;
    }
    .shop_fei_1 p time{
        color:#fc1dac;
    }
    .shop_fei_1 span{
        position:absolute;
        display:block;
        width:1.18rem;
        height:0.35rem;
        line-height:0.35rem;
        color:#8b7527;
        font-size:0.22rem;
        border-radius:0.5rem;
        text-align:center;
        background: -webkit-linear-gradient(left, #feeda0 , #ffd882); /* Safari 5.1 - 6.0 */
        background: -o-linear-gradient(right, #feeda0, #ffd882); /* Opera 11.1 - 12.0 */
        background: -moz-linear-gradient(right,  #feeda0, #ffd882); /* Firefox 3.6 - 15 */
        background: linear-gradient(to right, #feeda0, #ffd882); /* 标准的语法（必须放在最后） */
        top:0.33rem;
        left:0.1rem;
    }
    .shop_fei_1{
        width:100%;
        height:0.85rem;
        border-bottom:0.01rem solid #f0f0f0;
        padding-top:0.14rem;
        position:relative;
    }
    .shop_fei{
        min-height:2rem;
        width:100%;
    }
    /*非会员购物车*/
    .z_price{
        width:100%;
        height:0.79rem;
        line-height:0.79rem;
        border-bottom:0.1rem solid #f5f4f2;
        font-size:0.26rem;
        color:#9a9a9a;
    }
    .z_price span{
        height:0.79rem;
        display:block;
        float:right;
        margin-right:0.2rem;
    }
    .z_price span time{
        color:#fc1dac;
    }
    /*总价*/
    .invoice_details_shop{
        width:100%;
        height:0.79rem;
        border-bottom:0.01rem solid #f0f0f0;
        position:relative;
    }
    .invoice_details_shop img {
        position:absolute;
        display:block;
        width:0.21rem;
        height:0.36rem;
        top:0.2rem;
        right:0.15rem;
    }
    .invoice_details_shop span:nth-of-type(1){
        width:1.02rem;
        height:0.79rem;
        line-height:0.79rem;
        color:#494848;
        font-size:0.24rem;
        float:left;
       text-indent: 0.2rem;
    }
    .invoice_details_shop span:nth-of-type(2){
        height:0.79rem;
        line-height:0.79rem;
        color:#bfbfbf;
        font-size:0.24rem;
        float:right;
      margin-right:0.43rem;
    }
    /*发票*/
    .shop_zong2 img{
        display:block;
        height:0.3rem;
        width:0.3rem;
        position:absolute;
        top:0.22rem;
        left:0.7rem;
    }
    .shop_zong2 span:nth-of-type(1){
        display:block;
        width:1.76rem;
        height:0.79rem;
        float:left;
        line-height:0.79rem;
        color:#494848;
        font-size:0.26rem;
        text-indent: 0.2rem;
    }
    .shop_zong2 span:nth-of-type(2){
        height:0.79rem;
        float:right;
        color:#fd71c3;
        font-size:0.24rem;
        line-height:0.79rem;
        display:block;
        margin-right:0.2rem;
    }
    .shop_zong2{
        width:100%;
        height:0.79rem;
        border-bottom:0.01rem solid #f0f0f0;
        position:relative;
    }
    .shop_zong1 span:nth-of-type(1){
        display:block;
        width:1.76rem;
        height:0.79rem;
        float:left;
        line-height:0.79rem;
        color:#494848;
        font-size:0.26rem;
        text-indent: 0.2rem;
    }
    .shop_zong1 span:nth-of-type(2){
        height:0.79rem;
        float:right;
        color:#fd71c3;
        font-size:0.24rem;
        line-height:0.79rem;
        display:block;
        margin-right:0.2rem;
    }
    .shop_zong1{
        width:100%;
        height:0.79rem;
        border-bottom:0.01rem solid #f0f0f0;
    }
    .shop_goods_m_p_te img{
        position:absolute;
        display:block;
        width:0.21rem;
        height:0.36rem;
        top:0.05rem;
        right:0.15rem;
    }
    .shop_goods_m .shop_goods_m_p_te{
        width:100%;
        height:0.5rem;
        position:relative;
    }
    .shop_goods_m_p_te span:nth-of-type(2){
        display:block;
        height:0.5rem;
        line-height:0.5rem;
        font-size:0.24rem;
        color:#494848;
        width:2rem;
        padding-left:0.55rem;
       /* overflow: hidden; !*!*自动隐藏文字*!*!
        text-overflow: ellipsis;!*!*文字隐藏后添加省略号*!*!
        white-space: nowrap;*/
        float:left;
    }
    .shop_goods_m_p_te span:nth-of-type(3){
        height:0.5rem;
        float:right;
        /*color:#fd71c3;*/
        font-size:0.24rem;
        line-height:0.5rem;
        display:block;
        margin-right: 0.43rem;
    }
    .shop_goods_m_p_te span:nth-of-type(1){
        display:block;
        height:0.28rem;
        width:0.28rem;
        line-height:0.28rem;
        text-align:center;
        color:#ffffff;
        font-size:0.23rem;
        background:#fc1dac;
        position:absolute;
        top:0.1rem;
        left:0.18rem;
    }
    /*红包*/
    .shop_goods_m .shop_goods_m_p{
        width:100%;
        height:0.5rem;
        position:relative;
    }
    .shop_goods_m_p span:nth-of-type(2){
        display:block;
        height:0.5rem;
        line-height:0.5rem;
        font-size:0.24rem;
        color:#494848;
        width:4.45rem;
        padding-left:0.55rem;
        overflow: hidden; /*!*自动隐藏文字*!*/
        text-overflow: ellipsis;/*!*文字隐藏后添加省略号*!*/
        white-space: nowrap;
        float:left;
    }
    .shop_goods_m_p span:nth-of-type(3){
        height:0.5rem;
        float:right;
        color:#fd71c3;
        font-size:0.24rem;
        line-height:0.5rem;
        display:block;
        margin-right:0.2rem;
    }
    .shop_goods_m_p span:nth-of-type(1){
        display:block;
        height:0.28rem;
        width:0.28rem;
        line-height:0.28rem;
        text-align:center;
        color:#ffffff;
        font-size:0.23rem;
        background:#fc1dac;
        position:absolute;
        top:0.1rem;
        left:0.18rem;
    }
    .shop_goods_m{
        width:100%;
        min-height:0.5rem;
        padding-top:0.16rem;

        border-bottom:0.01rem solid #f0f0f0;
        border-top:0.01rem solid #f0f0f0;
    }
    /*商品优惠红包列表*/
    .shop_zong span:nth-of-type(1){
        display:block;
        width:1.76rem;
        height:0.8rem;
        float:left;
        line-height:0.8rem;
        color:#b3b3b3;
        font-size:0.26rem;
        text-indent: 0.2rem;
    }
    .shop_zong span:nth-of-type(2){
        height:0.8rem;
        float:right;
        color:#fd71c3;
        font-size:0.24rem;
        line-height:0.8rem;
        display:block;
        margin-right:0.2rem;
    }
    .shop_zong{
        width:100%;
        height:0.8rem;
    }
    .shop_border{
        width:100%;
        height:0.1rem;
        background:#f5f4f2;
    }
    /*购物车新版*/
    .shop_min{
        min-height:2rem;
        width:100%;
    }
    /*添加地址选择地址的文字样式*/
    .cancel{
        color:#74c3fd;
    }
    .picker-title{
        color:#74c3fd;
    }
    .confirm,.confirm-hook{color:#74c3fd;}

    /*选择收货地址的样式*/
    #span_3.showY{
        color:#43b4fc;
        border-color:#43b4fc;
    }
    #span_4.showY{
        color:#43b4fc;
        border-color:#43b4fc;
    }
    /*弹窗背景*/
    .back_c{
        height:100%;
        width:100%;
        background:#000000;
        filter:alpha(opacity=50);
        opacity: 0.5;
        position:fixed;
        left:0;
        top:0;
        z-index: 1;
    }
    /*11111*/
    #img_te{
        left: 6rem;
    }

    /*..00*/
    .add{
        position:fixed;
        z-index:3;
        bottom:0;
        left:0;
        background: #ffffff;
        height:6rem;
    }
    #a_click{
        width:100%;
        background: #ffffff;
    }
    .a_click button{
        display:block;
        height:0.84rem;
        width:5.71rem;
        background:#29adfc;
        color:#ffffff;
        line-height:0.84rem;
        text-align:center;
        outline: none;
        border:0;
        margin:1.45rem 0.35rem 0 0.35rem;
        font-size:0.3rem;
    }
    .add_p{
        height:3.6rem;
        width:100%;
    }
    .add_p p:nth-of-type(6){
        height:0.8rem;
        width:100%;
        display:flex;
        flex-direction: row;
    }
    .add_p p:nth-of-type(6) .s_l{
        width:2.33rem;
        display:block;
        height:0.8rem;
        line-height:0.8rem;
        color:#3c3c3c;
        font-size:0.22rem;
        text-indent: 0.3rem;
    }
    .add_p p:nth-of-type(6) .s_l1{
        display:block;
        height:0.8rem;
        width:4.07rem;
        font-size:0.2rem;
        line-height:0.8rem;
        position:relative;
        /*margin-left:0.5rem;*/
    }
    .add_p p{
        border-bottom:1px solid #f0f0f0;
    }
    .add_p p:nth-of-type(1){
        height:0.8rem;
        width:100%;
        line-height:0.8rem;
        /*text-align:center;*/
        text-indent: 2.5rem;
        color:#29adfc;
        font-size:0.28rem;
        position:relative;
    }
    .add_p p:nth-of-type(1) img{
        position:absolute;
        top: 0.2rem;
        left:0.2rem;
        height:0.44rem;
        width:0.44rem;
    }

   /* .add_p p:nth-of-type(1) img{
        display:block;
        position:absolute;
        width:0.31rem;
        height:0.37rem;
        left:0.27rem;
        top:0.23rem;
    }*/
    .add_p p:nth-of-type(2){
        height:0.8rem;
        width:100%;
        display:flex;
        flex-direction: row;
    }
    .add_p p:nth-of-type(2) span{
        width:2.33rem;
        display:block;
        height:0.8rem;
        line-height:0.8rem;
        color:#3c3c3c;
        font-size:0.22rem;
        text-indent: 0.3rem;
    }
    .add_p p:nth-of-type(2) input{
        display:block;
        height:0.8rem;
        width:4.07rem;
        border:0;
        outline:none;
        font-size:0.2rem;
    }
    .add_p p:nth-of-type(3){
        height:0.8rem;
        width:100%;
        display:flex;
        flex-direction: row;
        overflow: hidden;
    }
    .add_p p:nth-of-type(3) span{
        width:2.33rem;
        display:block;
        height:0.8rem;
        line-height:0.8rem;
        color:#3c3c3c;
        text-indent: 0.3rem;
        font-size:0.22rem;
    }
    .add_p p:nth-of-type(3) input{
        display:block;
        height:0.8rem;
        width:4.07rem;
        border:0;
        outline:none;
        font-size:0.2rem;
    }
    .add_p p:nth-of-type(4){
        height:0.8rem;
        width:100%;
        display:flex;
        flex-direction: row;
        position:relative;
    }
    .add_p p:nth-of-type(4) span:nth-of-type(1){
        width:2.33rem;
        display:block;
        height:0.8rem;
        line-height:0.8rem;
        color:#3c3c3c;
        font-size:0.22rem;
        text-indent: 0.3rem;
    }
    .add_p p:nth-of-type(4) span:nth-of-type(2){
        display:block;
        height:0.8rem;
        width:4.07rem;
        line-height:0.8rem;
        font-size:0.18rem;
    }
    .add_p p:nth-of-type(4) img{
        display:block;
        position:absolute;
        height:0.37rem;
        width:0.3rem;
        right:0.3rem;
        top:0.17rem;
    }
    .add_p p:nth-of-type(5){
        height:0.8rem;
        width:100%;
        display:flex;
        flex-direction: row;
        overflow:hidden;
    }
    .add_p p:nth-of-type(5) span:nth-of-type(1){
        width:2.33rem;
        display:block;
        height:0.8rem;
        line-height:0.8rem;
        color:#3c3c3c;
        font-size:0.22rem;
        text-indent: 0.3rem;
    }
    .add_p p:nth-of-type(5) input{
        display:block;
        height:0.8rem;
        width:4.07rem;
        line-height:0.6rem;
        border: 0;
        outline: none;
        font-size:0.2rem;
        overflow: hidden; /*!*自动隐藏文字*!*/
        text-overflow: ellipsis;/*!*文字隐藏后添加省略号*!*/
        white-space: nowrap;
    }
    /*999999*/


    /*yyyyyyyy*/
    .shop_te{
       /* overflow-y: scroll;*/
        overflow-x:hidden;
    }
    .shop_box{
        height:100%;
    }
    /*111111111111*/
    .address_2{
        height:7.2rem;
        width:100%;
        position:fixed;
        bottom:0;
        overflow-y:scroll;
        z-index:2;
    }
    /*111111111*/
    .address_2 p:nth-of-type(1){
        height:0.8rem;
        width:100%;
        line-height:0.8rem;
        text-align:center;
        color:#74c3fd;
        font-size:0.28rem;
        border-bottom:1px solid #d9d9d9;
        background:#ffffff;
        position:relative;
    }
    .address_2 p:nth-of-type(1) img{
        position:absolute;
        top: 0.2rem;
        left:0.2rem;
        height:0.44rem;
        width:0.44rem;

    }
    .address_2 p:nth-of-type(2){
        height:0.8rem;
        width:100%;
        background:#ffffff;
    }
    .address_2 a{
        height:0.8rem;
        width:100%;
        background:#29adfc;
        line-height:0.8rem;
        text-align:center;
        font-size:0.3rem;
        color:#ffffff;
        display:block;
        text-decoration:none;
    }
    /*添加地址的默认地址*/
    .shop_ming_span{
           display: block;
           position: absolute;
           height: 0.25rem;
           width: 0.25rem;
           top: 1rem;
           left: 0.26rem;
           border:0.01rem solid #cccccc;
           border-radius:50%;
       }
  .shop2_con_detail img:nth-of-type(1){
      position:absolute;
      display:block;
      height:0.44rem;
      width:0.44rem;
      top: 0.6rem;
      right:0.3rem;
  }
  .shop2_detail_add{
      height: 5.6rem;
      width: 100%;
      overflow-y: scroll;
      background: #ffffff;
  }
  .shop2_con_detail{
      padding-top: 0.3rem;
      min-height: 1.5rem;
      /* margin: 0.1rem 0; */
      width: 100%;
      position: relative;
      border-bottom: 1px solid #f0f0f0;
      background: #fff;
  }
  .xiu_2{
      width: 100%;
      height: 0.56rem;
      line-height: 0.56rem;
      color: black;
      font-size:0.28rem;
      /* margin-bottom: 0.1rem; */
      text-indent: 0.64rem;
  }
  .xiu_3{
      width:100%;
      height:1.04em;
      color:#969696;
      font-size:0.21rem;

  }
  .xiu_3 span{
      margin-left: 0.7rem;
      display: block;
      width: 3.9rem;
      font-size: 0.22rem;
      height: 1.04rem;
      line-height: 0.5rem;
      word-wrap: break-word;
  }
  .a_adress{
      position:fixed;
      bottom:0;
      z-index:3;
  }
    /*22222222*/
    .jie_s{
        display:flex;
        height:0.83rem;
        width:100%;
        /*box-shadow: -3px -3px 0px 0px #e3e3e3;*/
        position: fixed;
        bottom: 0;
        background: #fff;
        border-top:1px solid #eee;
    }
    .jie_s li{
        list-style:none;
        flex:1;
        font-size:0.22rem;
        line-height:0.83rem;
        text-align:center;
        color:#929292;
    }
    .jie_s li:nth-of-type(1){
        position:relative;
    }
    .jie_s li:nth-of-type(3){
        color:#fcfcfc;
        background:#bfbfbf;
    }
    .jie_s li:nth-of-type(3) a{
        color:#fcfcfc;
        background:#bfbfbf;
        text-decoration:none;
        display:block;
        flex:1;
    }
    .jie_s li:nth-of-type(3) a.selected{
        background-color: #74c3fd;
    }
    .jie_s li:nth-of-type(2) span{
        color:#74c3fd;
    }
    .jie_s li:nth-of-type(1) span{
        display:block;
        height:0.25rem;
        width:0.25rem;
        border-radius:50%;
        border:1px solid #d2d1cf;
        position:absolute;
        left:0.25rem;
        top:0.29rem;
    }
    .shop_d_1{
        height:2rem;
        width:2.24rem;

        flex:1;
        position:relative;
    }
    .shop_d_1 img{
        display:block;
        height:1.54rem;
        width:1.54rem;
        margin:0.24rem 0 0 0.65rem;
    }
    .radio{
        display:block;
        height:0.25rem;
        width:0.25rem;
        border-radius:50%;
        border:1px solid #d2d1cf;
        position:absolute;
        left:0.24rem;
        top:0.9rem;
    }
    .radio_selected{
        /*background:url(../image/blue_dui.png) no-repeat -0.09rem -0.15rem;*/
        background:url(../image/blue_2.jpg) no-repeat;
        background-size:cover;
        -webkit-background-size: cover;
        border:0;
    }
    .jie_s li:nth-of-type(1) span.radio_selected_quan{
    background:url(../image/blue_2.jpg) no-repeat;
    background-size:cover;
    -webkit-background-size: cover;
    border:0;
}
    .shop_d_2{
        width:2.04rem;
        height:1.8rem;
        padding-top:0.2rem;
        flex:1;
    }
    .shop_d_2 h6{
	/*margin-top:0.2rem;*/
        height:0.8rem;
        word-break:break-all;
        font-weight:normal;
        /*text-align:center;*/
        /*text-indent: 0.4rem;*/
	    padding-left:0.4rem;
        line-height:0.3rem;
        color:#353535;
        font-size:0.24rem;
    }
    .shop_d_2 .sp_p{
        height:0.45rem;
        width:2.5rem;
        color:#9e9e9e;
        font-size:0.20rem;
        line-height:0.45rem;
        /*text-align:center;*/
        text-indent: 0.4rem;
    }
    .shop_d_3{
        height:0.62rem;
        width:2.04rem;
        padding-top:1.38rem;
        position:relative;
        flex:1;
    }
    .shop_a_j{
        height:0.44rem;
        width:2.04rem;
        /*position:relative;
        margin-top:1.38rem;*/
        margin-left:.4rem;
    }
    .j_1{
        height:0.44rem;
        width:0.44rem;
        float:left;
    }
    .j_1 img{
        display:block;
        width:0.44rem;
        height:0.44rem;
    }
    .jia_add{
        height:0.44rem;
        width:0.44rem;
        float:left;
    }
    .jia_add img{
        display:block;
        width:0.44rem;
        height:0.44rem;
    }
    /*.shop_a_j div img{
        display:block;

        border-radius:50%;
        color:#f77602;
        border:1px solid #dbdbdb;
        text-align:center;
    }*/
    .shop_a_j span{
        display:block;
        height:0.44rem;
        width:0.44rem;
        color:#000000;
        line-height:0.44rem;
        text-align:center;
        /*text-indent: 0.2rem;*/
        font-size:0.24rem;
        float:left;
       /* margin: .03rem .19rem;*/
    }
    .shop_add_r span:nth-of-type(1){
        height:0.26rem;

        line-height:0.26rem;

        text-indent: 0.3rem;
        color:#fc37b2;
        font-size:0.24rem;
        position:absolute;
        left:0.1rem;
        top:0.1rem;
    }
    .shop_add_r span:nth-of-type(2){
        height:0.25rem;
        width:0.66rem;
        line-height:0.25rem;
        text-align:center;
        border:1px solid #a5be87;
        border-radius:8px;
        font-size:0.16rem;
        color:#a5be87;
        position:absolute;
        top:0.2rem;
        right:0;
    }
    .shop_add_r{
        width:1.5rem;
        height: 0.86rem;
        position:relative;
    }
    .shop_add{
        min-height:1rem;
        width:100%;
        background:#f5f4f2;
     /*   padding-top:0.2rem;*/
    }

    .shop_lis{
        height:2rem;
        width:100%;
        position:relative;
        border-top:1px solid #f0f0f0;
        display:flex;
    }
    .shop_list{
        height:0.6rem;
        width:100%;
        display:flex;
    }
    .shop_list li{
        flex:1;
        line-height:0.6rem;
        text-align:center;
        list-style:none;
        font-size:0.22rem;
        color:#9a9a9a;
    }
    .shop_con{
        min-height:0.94rem;
        width:100%;
        position:relative;
        background:#ffffff;
    }
   /* .shop_con img:nth-of-type(1){
        display:block;
        position:absolute;
        height:0.03rem;
        width:100%;
       !* top:-0.03rem;*!
    }*/
    .shop_con img:nth-of-type(1){
        display:block;
        position:absolute;
        height:0.4rem;
        width:0.4rem;
        left:0.24em;
        top:0.3rem;
    }
    .shop_con img:nth-of-type(2){
        display:block;
        position:absolute;
        right:0.22rem;
        top: 0.3rem;
        height:0.36rem;
        width:0.2rem;
    }
    .shop_con h5{
        height: 0.94rem;
        line-height:0.94rem;
        color:#5d5d5d;
        font-size:0.22rem;
        text-indent: 0.7rem;
    }
    .shop_detail_add_2{
        min-height:1.6rem;
        width:100%;
        background:#f5f4f2;
    }
    .shop_add{
        min-height:1rem;
        width:100%;
        background:#f5f4f2;
       /* padding-top:0.2rem;*/
    }
    .shop_con_detail p:nth-of-type(2){
        width:4rem;
        height:0.3rem;
        line-height:0.3rem;
        font-size:0.2rem;
        word-wrap:break-word;
        position:absolute;
        color:#8f8f8f;
        left:0.7rem;
        top:0.65rem;
    }
    .shop_con_detail p:nth-of-type(1){
        height:0.7rem;
        width:100%;
        padding:0.2rem 0 0 0.66rem;
    }
    .shop_con_detail p:nth-of-type(1) span{
        color:#5d5d5d;
        font-size:0.28rem;
        display:block;
        float:left;
        line-height:0.4rem;
    }
    .shop_con_detail p:nth-of-type(1) span:nth-of-type(1){
      /*  height:0.7rem;*/
        min-width:1rem;
    }
    .shop_con_detail{
        min-height:1.5rem;;
        width:100%;
        position:relative;
        background:#ffffff;
    }
   /* .shop_con_detail img:nth-of-type(1){
        display:block;
        position:absolute;
        height:0.03rem;
        width:100%;
        top:-0.08rem;
    }*/
    .shop_con_detail img:nth-of-type(2){
        display:block;
        position:absolute;
        height:0.4rem;
        width:0.4rem;
        left:0.2em;
        top:0.6rem;
    }
    .shop_con_detail img:nth-of-type(1){
        display:block;
        position:absolute;
        right:0.22rem;
        top: 0.7rem;
        height:0.36rem;
        width:0.2rem;
    }


    .shop{
        height:0.8rem;
        width:100%;
       /* border-bottom:1px solid #cfcecd;*/
        position:relative;
        background:#ffffff;

    }
    .shop img:nth-of-type(1){
        height:0.36rem;
        width:0.36rem;
        display:block;
        position:absolute;
        left:0.25rem;
        top:0.2rem;
    }
    .shop img:nth-of-type(2){
        display:block;
        position:absolute;
        height:0.03rem;
        width:100%;
        bottom:0;
        left:0;
    }
    .shop h4{
        height:0.79rem;
        color:#74c3fd;
        font-size:0.28rem;
        line-height:0.79rem;
        text-align:center;
        font-weight:normal;
    }
    .shop span{
        display:block;
        height:0.79rem;
        line-height: 0.79rem;
        font-size:0.23rem;
        color:#74c3fd;
        position:absolute;
        right:0.24rem;
        top:0;
    }


    .jie_s li:nth-of-type(3).selected{
        background-color:#74c3fd;
    }
</style>

